<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <button onclick="ajaxGet()">ajax get</button>
    <button onclick="ajaxPost()">ajax post</button>
    <button onclick="ajax()">ajax</button>

    <script src="/static/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script>
        function  ajaxGet(){
            $.get(
                '/ajax1',
                {'name':'张三1'},
                function (jsonobj){
                    console.log(jsonobj);
                },
                'json'
            );
        }
        function ajaxPost(){
            $.post(
                '/ajax1',
                {'name': '张三2'}, //json
                function (jsonObj) {//对调函数
                    console.log(jsonObj);
                },
                'json'
            );
        }
        function  ajax(){
            $.ajax({
                async:true,
                url:'/ajax1',
                type:'POST',
                data:{'name':'张三丰'},
                success: function (jsonobj){
                    console.log(jsonobj);
                },
                dataType:'json'
                });
        }
    </script>

</body>
</html>
